package map;

public class Graph {
	
	private final int INFINITY = 999999999;
	
	private int[][] graph = {
			{0,		2,		2,		INFINITY,		INFINITY,	 INFINITY},
			{2,		0,		INFINITY,		3,		INFINITY,	 INFINITY},
			{2,		INFINITY,		0,		4,		5,		     INFINITY},
			{INFINITY,		3,		4,		0,		3,			 4},
			{INFINITY,		INFINITY,		5,		3,		0,	 1},
			{INFINITY,		INFINITY, 		INFINITY,		4,	 1,		0}
	};
	
	
	public Graph()
	{
	}
	
	public int getShortestRoute(int startPoint, int endPoint)
	{
		int numberItems = graph.length; 
		for (int k = 0; k<(numberItems); k++)
		{
			for (int i = 0; i<(numberItems); i++)
			{
				for (int j = 0; j<(numberItems); j++)
				{
					graph[i][j] = Math.min(graph[i][j], graph[i][k] + graph[k][j]);
				}
			}
		}
		return graph[startPoint-1][endPoint-1];
	}
}
